/*
 * Copyright 2023 OpenSPG Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied.
 */

package com.antgroup.openspg.core.schema.model;

import com.antgroup.openspg.server.common.model.base.BaseValObj;
import java.util.Objects;

/**
 * Value object of ontology ID, each ontology has a unique id, which can be either a serialized ID
 * generated by the database or a semantic ID with meaningful business information.
 */
public class OntologyId extends BaseValObj {

  private static final long serialVersionUID = 5328107610639924776L;

  /** Unique id. */
  private Long uniqueId;

  /** Corresponding ID for each alter. */
  private Long alterId;

  public Long getUniqueId() {
    return uniqueId;
  }

  public void setUniqueId(Long uniqueId) {
    this.uniqueId = uniqueId;
  }

  public Long getAlterId() {
    return alterId;
  }

  public void setAlterId(Long alterId) {
    this.alterId = alterId;
  }

  public OntologyId() {}

  public OntologyId(Long uniqueId) {
    this.uniqueId = uniqueId;
  }

  public OntologyId(Long uniqueId, Long alterId) {
    this.uniqueId = uniqueId;
    this.alterId = alterId;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    OntologyId that = (OntologyId) o;
    return Objects.equals(uniqueId, that.uniqueId);
  }

  @Override
  public int hashCode() {
    return Objects.hash(uniqueId);
  }
}
